-
Notifications
You must be signed in to change notification settings - Fork 92
gpep-update-other-form-entry-by-ep-token.php: Improved snippet to support post entry update actions.
#1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…upport post entry update actions.
WalkthroughThe pull request modifies the logic used to update a Gravity Forms entry after submission. Instead of using Changes
Sequence Diagram(s)sequenceDiagram
participant F as Form Submission
participant H as Action Hook (gform_after_submission_123)
participant API as GFAPI
F->>H: Submit form entry
H->>H: Update target field in entry array with new value
H->>API: Call GFAPI::update_entry(updated entry)
Suggested Reviewers
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php (1)
46-47: Great improvement to trigger post-update actions.Replacing
GFAPI::update_entry_field()with directly modifying the entry array and usingGFAPI::update_entry()ensures that post-entry update actions will be triggered, which aligns with the PR objectives.However, consider adding error handling around the update operation:
$source_entry[ $target_field_id ] = $update_value; - GFAPI::update_entry( $source_entry ); + $update_result = GFAPI::update_entry( $source_entry ); + if ( is_wp_error( $update_result ) ) { + // Log error or handle the failure case + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php(2 hunks)
🔇 Additional comments (1)
gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php (1)
33-33: Style change looks good.The added space before the function parenthesis improves readability and is consistent with common PHP coding standards.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2883160941/79774
Summary
This snippet previously used
GFAPI::update_entry_field(), which updated a specific field but did not trigger post-entry update actions. Now, it has been updated to useGFAPI::update_entry, ensuring that post-entry update actions are triggered and subsequent actions are performed as expected.